package com.qidian.mes.controller;

import com.qidian.mes.pojo.Process;
import com.qidian.mes.service.ProcessService;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("/process")
@CrossOrigin
public class ProcessController {
    @Autowired
    private ProcessService processService;

    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, Process process){
        return processService.list(page,limit,process);
    }
    @PostMapping("/save")
    public MESResult save(@RequestBody Process process){
        System.out.println("============================="+process);
        return processService.save(process);
    }

    @GetMapping("/get")
    public MESResult get(Long processId){
        return processService.selectById(processId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody Process process){
        return processService.update(process);
    }
    @DeleteMapping("/delete")
    public MESResult delete(Long processId){
        return processService.delete(processId);
    }
}
